package com.ruoyi.system.task;


import com.ruoyi.system.domain.BdmUser;
import com.ruoyi.system.service.IBdmUserService;
import com.ruoyi.system.service.IDistributionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 分销逻辑服务类
 */

@Slf4j
@Component("distributionTask")
public class DistributionTask {


    @Autowired
    private IDistributionService distributionService;

    @Autowired
    private IBdmUserService iBdmUserService;

    //用户
    @Autowired
    private IBdmUserService bdmUserService;

    public void setLocation() {
        log.info("计算设置1号位2号位业绩目标的定时任务执行了..........................");
        distributionService.setLocation();

    }

    public void shareOutBonus() {
        log.info("每月月初计算上月奖金池子分红的定时任务执行了..........................");
        distributionService.shareOutBonus();
    }


    public void updateToken() {
        log.info("聚水潭更新token接口执行了..........................");
        distributionService.refreshToken();
    }

    public void emptyUserIntegral() {
        log.info("每年1月1号清空用户积分接口执行了..........................");
        iBdmUserService.lambdaUpdate().set(BdmUser::getCreditScore,0).ne(BdmUser::getCreditScore,0).update();
    }
}
